<%@ page import="com.interfaces.VisaApplicationInfoController" %>
<%@ page import="java.util.Random" %>
<%@ page import="com.core.sysDict.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="com.core.sysDict.SysDictJsp" %><!DOCTYPE html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	
	    <%
        String path = request.getContextPath();
        path = "/".equals(path)?"":path;
        request.setAttribute("path", path);
        String sysDictJson=SysDictJsp.getSysDictJson(session);
    %>
    <script type="text/javascript">
        var path = "${path}";
    </script>
    
<!-- jQuery 2.2.3 -->
<script src="${path}/public/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="${path}/public/adminlte/plugins/jQueryUI/jquery-ui.min.js"></script>

	
	<title>身元保証書発行システム 身元保証書</title>

	<script type="text/JavaScript" language="JavaScript">
	function doReturn(){
		location.href='./identity_list.php';
		return false;
	}

	function doSave(){
		var message = "登録します。よろしいですか？";
		if( confirm(message) ){
			return true;
		}else{
			return false;
		}
	}

	//中国側旅行会社のデータ取得
	function getChinaData(){
		
		//既存の項目をクリア
		$('#CHINA_AGENT_ID').val('');
		$('#viewAgent_company').val('');
		$('#viewAgent_diplomat').val('');

		if( $('#CHINA_AGENT_CODE').val() == '' ){
			alert('指定番号を入力してください');
			return false;
		}else{
			$.ajax({
				type: "POST",
				url: "${path}/visaMock/query",
				data: {CHINA_AGENT_CODE: $("#CHINA_AGENT_CODE").val() },
				dataType: 'json',
				success: function(json){
					alert("hahahaha");
					if(!json.CHINA_AGENT_ID){
						alert('入力された指定番号は存在しません');
					}else{
						$('#CHINA_AGENT_ID').val(json.CHINA_AGENT_ID);
						$('#viewAgent_company').val(json.COMPANY_NAME);
						$('#viewAgent_diplomat').val(json.DIPLOMAT_NAME);
					}
					return false;
				},
				error : function(){
					alert('データの取得に失敗しました');
					return false;
				}
			});
		}
		
		
	}
	$(function() {
		$.fn.extend({
			toggleButtons : function(callback){
				var radios = this;
				radios.bind("change", function(e){
					radios.closest("label").removeClass("selected");
					$(e.target).closest("label").addClass("selected");
					 callback.call(this, e);
				});
				radios.closest("label").bind("click", function(e){
					if( $(this).find("input:checked").size() == 0 )
						$(this).find("input").attr("checked","checked").trigger("change");
				});
				radios.filter(":checked").trigger("change");
			}
		});

		$.datepicker.regional['ja'] = {
			closeText: '閉じる',
			prevText: '&#x3c;前',
			nextText: '次&#x3e;',
			currentText: '今日',
			monthNames: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
			monthNamesShort: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
			dayNames: ['日曜日','月曜日','火曜日','水曜日','木曜日','金曜日','土曜日'],
			dayNamesShort: ['日','月','火','水','木','金','土'],
			dayNamesMin: ['日','月','火','水','木','金','土'],
			weekHeader: '週',
			dateFormat: 'yy/mm/dd',
			firstDay: 0,
			isRTL: false,
			showMonthAfterYear: true,
			changeMonth:true,
			changeYear:true,
			minDate: "2017/08/30",
			maxDate:new Date(2040, 11,31),
			yearRange:'2000:2040'
		};
		$.datepicker.setDefaults($.datepicker.regional['ja']);

		$('#ARRIVAL_DATE').datepicker({
			maxDate: $('#DEPARTURE_DATE').val(),
			onSelect: function(dateText, inst){
				$('#DEPARTURE_DATE').datepicker('option', 'minDate', dateText);
			}
		});
		$("#calendarClearARRIVAL_DATE").click(function(){
			$("#ARRIVAL_DATE").val("");
			$('#DEPARTURE_DATE').datepicker('option', 'minDate', '2017/08/30');
		});

		$('#DEPARTURE_DATE').datepicker({
			onSelect: function(dateText, inst){
				$('#ARRIVAL_DATE').datepicker('option', 'maxDate', dateText);
			}
		});
		$("#calendarClearDEPARTURE_DATE").click(function(){
			$("#DEPARTURE_DATE").val("");
			$('#ARRIVAL_DATE').datepicker('option', 'maxDate', "");
		});

		selectVisa("");
        toggleVisa3Pref();
		$('input[name="VISA_TYPE_1"]').toggleButtons(function(e){
			var val = $('input[name="VISA_TYPE_1"]:checked').val();
			selectVisa(val);
            toggleVisa3Pref();
		});
		$('input[name="VISA_TYPE_2"]').toggleButtons(function(e){
            toggleVisa3Pref();
		});
		selectVisitPref("0");
		$('input[name="VISA_VISIT_TYPE"]').toggleButtons(function(e){
			var val = $('input[name="VISA_VISIT_TYPE"]:checked').val();
			selectVisitPref(val);
		});
	});
	function selectVisa(val)
	{
		if( val == "1" || val == "2" || val == "")
		{
			$(".visa2").css('display', 'none');
		}else{
			$(".visa2").css('display', '');
			$("#VISA_1").attr('checked','');
			$("#VISA_2").attr('checked','');
			if( val == "3" || val == "4" )
			{
				$("#VISA_"+val).attr('checked','checked');
				$("#VISA_N").attr('checked','checked');
			}else if( val == "N" ){
				$("#VISA_N").attr('checked','checked');
			}
		}
	}
	function toggleVisa3Pref()
	{
        var val1 = $('input[name="VISA_TYPE_1"]:checked').val();
        var val2 = $('input[name="VISA_TYPE_2"]:checked').val();
        if( val1 == 'N' && val2 == 3 ){
            $(".visa_type_3").css('display', '');
        }else{
            $(".visa_type_3").css('display', 'none');
        }
    }
	function selectVisitPref(val)
	{
		if( val == "" || val == "0")
		{
			$(".visa_visit_type").css('display', 'none');
            $("#VISA_VISIT_TYPE_0").attr('checked','checked');
		}else{
			$(".visa_visit_type").css('display', '');
			$("#VISA_VISIT_TYPE_1").attr('checked','');
			$("#VISA_VISIT_TYPE_0").attr('checked','');
			if( val == "1" )
			{
				$("#VISA_VISIT_TYPE_"+val).attr('checked','checked');
            }
		}
	}
	function postData()
	{
		var val = $('input[name="VISA_TYPE_1"]:checked').val();
		
		if( val == "N" )
		{
			var val2 = $('input[name="VISA_TYPE_2"]:checked').val();
			if(val2)
			{
				val = val2;
			}
		}
		$("#VISA_TYPE").val(val);
		
	}

	</script>
	<style>
		.buttonGroup {
			margin: 10px 0;
		}
		.buttonGroup input[type="checkbox"],
		.buttonGroup input[type="radio"] {
			display: none;
		}
		.visa_textarea{
			margin:3px 0px 0px 0px;
		}
		.buttonGroup label {
			padding: 5px 15px;
			cursor:pointer;
			padding: 5px 15px;
			color:#4d4d4d;
			border:1px solid #DCDCDC;
			background-color:#E6E6E6;
			background: -moz-linear-gradient(top, #FFFFFF, #E6E6E6);
			background: -webkit-gradient(linear, left top, left bottom, from(#FFFFFF), to(#E6E6E6));
			filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#FFFFFFFF', endColorstr='#FFE6E6E6');
            -moz-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
		}
		.buttonGroup input[type="checkbox"]:checked + label,
		.buttonGroup input[type="radio"]:checked + label {
			color:#ffffff;
			border-color:#01407b #1471c8 #025cb0 #01407b;
			background-color:#025cb0;
			background: -moz-linear-gradient(top, #025cb0, #025cb0);
			background: -webkit-gradient(linear, left top, left bottom, from(#025cb0), to(#025cb0));
			filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#025cb0', endColorstr='#025cb0');
		}
		.buttonGroup label.checked,
		.buttonGroup label.selected{
			color:#ffffff;
			border-color:#01407b #1471c8 #025cb0 #01407b;
			background-color:#025cb0;
			background: -moz-linear-gradient(top, #025cb0, #025cb0);
			background: -webkit-gradient(linear, left top, left bottom, from(#025cb0), to(#025cb0));
			filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#025cb0', endColorstr='#025cb0');
		}

		.buttonGroup input[type="radio"]:hover + label,
		.buttonGroup label:hover
		{
			border-color:#01407b #1471c8 #025cb0 #01407b;
		}
		p.fontNormal{
			font-size:inherit;
		}
	</style>

</head>
<body>
<!-- #wrapper -->
<div id="wrapper">

	<!-- #container -->
	<div id="container">
		<!-- #header -->
		<div id="header">
			<div class="logo_area">
				<h1 id="logo"><a href="./top.php"><img src="/member/images/logo.jpg" /></a></h1>
				<div id="logout">
					<a href="/member/logout.php">ログアウト</a>
				</div>
			</div>

			<div class="h_contents">
				<!-- #navi -->
				<div id="gnavi">
					<ul>
						<li class="navi_04"><a href="/member/top.php" alt="TOPページ">TOPページ</a></li>
						<li class="navi_05_on"><a href="/member/identity_edit.php?mode=add" alt="身元保証書新規発行">身元保証書新規発行</a></li>
						<li class="navi_01"><a href="/member/identity_list.php" alt="発行情報検索一覧">発行情報検索一覧</a></li>
						<li class="navi_06"><a href="/member/summary_list.php" alt="帰国報告総括表作成">帰国報告総括表作成</a></li>
						<li class="navi_02"><a href="/member/mailerror.php" alt="エラーメール一覧">エラーメール一覧</a></li>
						<li class="navi_03 last"><a href="/member/password.php" alt="パスワード変更">パスワード変更</a></li>
					</ul>
				</div>
				<!-- /#navi -->
			</div>
		</div>
		<!-- /#header -->


				

	<!-- #contents -->
	<div id="contents">

		<div class="box">
			<h2 class="box_head">
				身元保証書新規発行　入力画面			</h2>
		</div>
				<form action="../visaMock/add" method="post" name="form" ENCTYPE="multipart/form-data">
			
			
			<table class="edit" cellspacing="0" cellpadding="0">
			<tr>
				<th width="230">中連協会員旅行会社名</th>
				<td>
					1602-005　途易集団日本株式会社
									</td>
			</tr>
			<tr>
				<th>中国側旅行会社名<span class="required">*</span></th>
				<td>
					<div style="float:left; height:70px; width:300px;">
											<input type="hidden" id="CHINA_AGENT_ID" name="CHINA_AGENT_ID" value="171" />
						指定番号 ： <input type="text" name="CHINA_AGENT_CODE" id="CHINA_AGENT_CODE" size="14" value="GTU-ZJ-026-0"  />
						<input type="button" value="検索" name="BTN_SEARCH" onclick="return getChinaData();" />
										</div>
					<div style="float:left; height:70px;" id="viewAgent">
						<p>
							　会社名 ： <input readonly="readonly" class="readonly" type="text" name="viewAgent_company" id="viewAgent_company" value="XXXX" />
						</p>
						<p>
							管轄公館 ： <input readonly="readonly" class="readonly" type="text" name="viewAgent_diplomat" id="viewAgent_diplomat" value="YYYYY" />
						</p>
					</div>
					<br clear="all" />
					
					<div style="float:left; width:300px;">
						*指定番号が不明の場合は、<a href="javascript:void(0)" onclick="window.open('./download_china_agent.php', 'pdf_download'); return false;" >こちら</a>
					</div>
					<div style="float:left;">
						*旅行会社名と管轄公館に間違いのないようご確認ください
					</div>
					<br clear="all"/>
				</td>
			</tr>
			<tr>
				<th>査証種別<span class="required">*</span></th>
				<td>
					<input type="hidden" name="VISA_TYPE" id="VISA_TYPE" value="" />
					<div class="buttonGroup visa1">
						<label for="VISA_1"><input type="radio" name="VISA_TYPE_1" value="1" id="VISA_1"/>団体査証</label>
						<label for="VISA_2"><input type="radio" name="VISA_TYPE_1" value="2" id="VISA_2"/>個人査証</label>
						<label for="VISA_N"><input type="radio" name="VISA_TYPE_1" value="N" id="VISA_N"/>数次査証?1回目</label>
					</div>
					<div class="buttonGroup visa2">
						<div class="visa_textarea">
							<div style="width:98%;margin:0px;padding:2px 0;border:1px solid #dbdbdb;border-bottom:2px solid #329fec">　数次査証?1回目選択画面</div>
							<div style="width:98%;margin:0px;padding:5px 0;border:1px solid #dbdbdb;">
								<div style="text-align:center; padding:10px 0;">
									<label for="VISA_3"><input type="radio" name="VISA_TYPE_2" value="3" id="VISA_3"/>沖縄及び東北六県数次査証（個人観光）?1回目</label>
									<label for="VISA_4"><input type="radio" name="VISA_TYPE_2" value="4" id="VISA_4"/>十分な経済力保有者向け数次査証（個人観光）?1回目</label>
								</div>
							</div>
							</div>
						</div>
					</div>
					<p class="errorMsg">※査証種別を入力してください</p>
				</td>
			</tr>
			<tr>
				<th>査証申請人（代表）氏名<span class="required">*</span></th>
				<td>
					<p>
						　簡体字 ： <input type="text" name="APPLICANT_NAME" style="width:300px;" value="测试" />
						
					</p>
					<p>
						ピンイン ： <input type="text" name="APPLICANT_PINYIN" style="width:300px;" value="test" />
						
					</p>
				</td>
			</tr>
			<tr>
				<th>代表者を除く他の申請人数<span class="required">*</span></th>
				<td>
					<input type="text" name="NUMBER_OF_TOURISTS" style="width:100px;text-align:right;" value="0" />名
					
				</td>
			</tr>
			<tr>
				<th>日本入国予定日<span class="required">*</span></th>
				<td>
					<input type="text" id="ARRIVAL_DATE" name="ARRIVAL_DATE" style="width:90px;" value="2017/08/31" readonly />
				&nbsp;<img src="/member/images/icon_eraser.jpg" width="23" height="23" alt="クリア" id="calendarClearARRIVAL_DATE" class="icon_cl_clear" />
					
				</td>
			</tr>
			<tr>
				<th>日本出国予定日<span class="required">*</span></th>
				<td>
					<input type="text" id="DEPARTURE_DATE" name="DEPARTURE_DATE" style="width:90px;" value="2017/09/08" readonly />
				&nbsp;<img src="/member/images/icon_eraser.jpg" width="23" height="23" alt="クリア" id="calendarClearDEPARTURE_DATE" class="icon_cl_clear" />
					
				</td>
			</tr>

			<tr class="visa_type_3">
				<th>沖縄及び東北六県での宿泊の有無<span class="required">*</span></th>
				<td>
					<div class="buttonGroup">
										    						<input type="checkbox" name="VISA_STAY_PREF_47" value="47" id="VISA_STAY_PREF_47" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_47">沖縄県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_2" value="2" id="VISA_STAY_PREF_2" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_2">青森県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_3" value="3" id="VISA_STAY_PREF_3" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_3">岩手県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_4" value="4" id="VISA_STAY_PREF_4" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_4">宮城県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_5" value="5" id="VISA_STAY_PREF_5" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_5">秋田県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_6" value="6" id="VISA_STAY_PREF_6" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_6">山形県</label>
										    						<input type="checkbox" name="VISA_STAY_PREF_7" value="7" id="VISA_STAY_PREF_7" class="VISA_STAY_PREF"/>
						<label for="VISA_STAY_PREF_7">福島県</label>
										</div>
					
				</td>
			</tr>
			<tr class="visa_type_3">
				<th>東北三県（岩手県、宮城県、福島県）<br/>への訪問の有無（通過は含まない）<span class="required">*</span></th>
				<td>
					<div class="buttonGroup visa1">
						<label for="VISA_VISIT_TYPE_1"><input type="radio" name="VISA_VISIT_TYPE" value="1" id="VISA_VISIT_TYPE_1"/>有</label>
						<label for="VISA_VISIT_TYPE_0"><input type="radio" name="VISA_VISIT_TYPE" value="0" id="VISA_VISIT_TYPE_0" checked/>無</label>
					</div>
					<div class="buttonGroup visa_visit_type">
						<div class="visa_textarea">
							<div style="width:98%;margin:0px;padding:2px 0;border:1px solid #dbdbdb;border-bottom:2px solid #329fec">　訪問先の県</div>
							<div style="width:98%;margin:0px;padding:5px 0;border:1px solid #dbdbdb;">
								<div style="padding:10px;">
                                                    					                                            <input type="checkbox" name="VISA_VISIT_PREF_3" value="3" id="VISA_VISIT_PREF_3" class="VISA_VISIT_PREF"/>
                                        <label for="VISA_VISIT_PREF_3">岩手県</label>
                                                    					                                            <input type="checkbox" name="VISA_VISIT_PREF_4" value="4" id="VISA_VISIT_PREF_4" class="VISA_VISIT_PREF"/>
                                        <label for="VISA_VISIT_PREF_4">宮城県</label>
                                                    					                                            <input type="checkbox" name="VISA_VISIT_PREF_7" value="7" id="VISA_VISIT_PREF_7" class="VISA_VISIT_PREF"/>
                                        <label for="VISA_VISIT_PREF_7">福島県</label>
                                    								</div>
							</div>
							</div>
						</div>
					</div>
					
				</td>
			</tr>


			</table>
			<input type="hidden" name="_PAGE_KEY" value="nI0AaNMD" />
			<div class="btn_area">
				<input type="submit" class="btn_blue w_200" value="確 認" name="BTN_CHECK_x" onfocus="this.blur()" onclick="postData()" />
			</div>
			<!-- edit -->
		</form>
		
	</div>
	<!--/#contents -->

		
		<!-- #footer -->
		<div id="footer">
			<div class="f_contents">
				Copyright 2010 Japan Council of Travel Agents For Chinese Visitors All Right Reserved.
			</div>
		</div>
		<!-- /#footer -->

	</div>
	<!-- /#container -->

</div>
<!-- /#wrapper -->
</body>
</html>